package com.itheima.thread.等待唤醒机制.快递案例;

import java.util.concurrent.ArrayBlockingQueue;

public class User extends Thread {
    ArrayBlockingQueue<String> box;

    public User(ArrayBlockingQueue<String> box) {
        this.box = box;
    }
    @Override
    public void run() {
        while (true){
            try {
                System.out.println(getName() + "取了一个" + box.take() + "然后离开了");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }
    }
}
